package com.xszx.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xszx.config.PageRequest;
import com.xszx.dao.ClientDao;
import com.xszx.entity.Client;
import com.xszx.entity.Cost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientService {
    @Autowired
    private ClientDao clientDao;
    public PageInfo<Client> getClientListInfo(PageRequest pageRequest) {
        PageHelper.startPage(pageRequest.getPage(), pageRequest.getSize());
        List<Client> clientList = clientDao.getClientListInfo(pageRequest);
        return new PageInfo<>(clientList);

    }

    public void addClient(Client client) {
        clientDao.addClient(client);
    }

    public Client getClientById(Integer id) {
        return clientDao.getClientById(id);
    }

    public void updateClient(Client client) {
        clientDao.updateClient(client);
    }

    public void deleteClient(Integer id) {
        clientDao.deleteClient(id);
    }

    public List<Client> getClientGoodsById(Integer id) {
        return clientDao.getClientGoodsById(id);
    }
}
